﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Threading.Tasks;
public partial class _4_5 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Diagnostics.StackTrace frame = new System.Diagnostics.StackTrace(System.Threading.Thread.CurrentThread,true);


        Response.Write(string.Join("<br/>", frame.GetFrames().Select(p=>p.ToString())));
        Response.Write("<br/><br/>--------------<br/>-----------------------" + xii);

        //异步请求一个数据();
    }


    public string xii { get {
        System.Diagnostics.StackTrace frame = new System.Diagnostics.StackTrace(System.Threading.Thread.CurrentThread, true);


        Response.Write(string.Join("<br/>", frame.GetFrames().Select(p => p.ToString())));
        return 
        

        ""; }
    }


    //异步IO操作
    void 异步请求一个数据()
    {
        Uri uri = new Uri("http://news.mydrivers.com/1/325/325681.htm");
        var dd =  funcAsync(uri);

        Response.Write(   dd.Result);
 
    }

    public async Task<string> funcAsync(Uri uri)
    {        WebClient wc = new WebClient();
        return await wc.DownloadStringTaskAsync(uri);
    }

 
}
 

 